Adaptive memory